October 24, 2016
rmarkdown and knitrReproducibility – the ability to recompute results – and replicability – the chances other experimenters will achieve a consistent result – are two foundational characteristics of successful scientific research.
repr
research
kids
The Sad Analyst's Infinite Loop:
trad
trad
rmarkdown and knitrRun the following to install the necessary packages:
install.packages(c('rmarkdown', 'knitr'))
Looks a lot like:
Markdown is a lightweight markup language, originally created by John Gruber and Aaron Swartz allowing people "to write using an easy-to-read, easy-to-write plain text format, then convert it to structurally valid XHTML (or HTML)".
ref
*italic* **bold** _italic_ __bold__
italic
bold
# Header 1 ## Header 2 ### Header 3
End a line with two or more spaces:
Roses are red, Violets are blue.
Unordered List:
* Item 1
* Item 2
+ Item 2a
- Item 2b
Ordered List:
1. Item 1
2. Item 2
3. Item 3
+ Item 3a
+ Item 3b
Unordered List:
Ordered List:
Inline Link:
I hope you aren't browsing [reddit](reddit.com)
I hope you aren't browsing reddit
Reference Link:
I hope you aren't browsing [reddit](r) [r]: reddit.com
I hope you aren't browsing reddit
Inline Image:

Reference Image:
 [ref]: ../images/betr-appr2.png
my-img
Blockquotes let you use the <blockquote> tag to let readers know you are quoting someone:
> Statistical thinking will one day be as necessary a qualification for efficient > citizenship as the ability to read and write. --H.G. Wells
Statistical thinking will one day be as necessary a qualification for efficient citizenship as the ability to read and write. –H.G. Wells
Plain code blocks are displayed in a fixed-width font but not evaulated.
``` This text is displayed verbatim / preformatted Useful if you want to inlcude code from other languages Or just want rigid formatting ```
LaTeX Inline equation: $equation$
Display equation: $$ equation $$
$$
\large{ \sigma^2 = \frac { \sum_{i=1}^{n} \left( x_i - \bar{x} \right) ^ 2} {n-1} }
$$
\[ \large{ \sigma^2 = \frac { \sum_{i=1}^{n} \left( x_i - \bar{x} \right) ^ 2} {n-1} }\]
You can use either of the following to insert a horizontal rule (<hr> tag) in your document to split up different sections.
---------
*********
| First Header | Second Header |
|---|---|
| Content Cell | Content Cell |
| Content Cell | Content Cell |
First Header | Second Header ------------- | ------------- Content Cell | Content Cell Content Cell | Content Cell
R Codechunk
library(knitr) # install if necessary my_table <- data.frame(Col1 = letters[1:3], Col2 = 1:3) kable(my_table)
| Col1 | Col2 |
|---|---|
| a | 1 |
| b | 2 |
| c | 3 |
anat
anat
anat
anat
R code is allowedcreate
create
Install editR from here
rmarkdown resourcesPlease read the following:
Additionally, select one of your previous assignments (perhaps one you didn't do great on) and re-do it using knitr and rmarkdown.